package com.larissa.android.note;

import androidx.annotation.NonNull;
import androidx.databinding.BaseObservable;
import androidx.databinding.Bindable;
import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.PrimaryKey;

import java.util.Date;
import java.util.UUID;
@Entity
public class Note extends BaseObservable {
    @NonNull
    @PrimaryKey
    @ColumnInfo(name="id")
    private UUID mId;
    @ColumnInfo(name="title")
    private String mTitle;
    @ColumnInfo(name="content")
    private String mContent;
    @ColumnInfo(name="date")
    private Date mDate;
    @ColumnInfo(name="status")
    private String mStatus;

    public Date getDate() {
        return mDate;
    }

    public void setDate(Date date) {
        mDate = date;
    }

    public String getStatus() {
        return mStatus;
    }

    public void setStatus(String status) {
        mStatus = status;
    }

    public String getNoteLog(){
        String noteLog=String.format("%s at %s",mStatus,mDate);
        return noteLog;
    }

    public void setNoteLog(String status){
        mDate=new Date();
        mStatus=status;
    }

    public UUID getId() {
        return mId;
    }

    public void setId(UUID id) {
        mId = id;
    }
    @Bindable
    public String getTitle() {
        return mTitle;
    }

    public void setTitle(String title) {
        mTitle = title;
        notifyPropertyChanged(BR.title);
    }
    @Bindable
    public String getContent() {
        return mContent;
    }

    public void setContent(String content) {
        mContent = content;
        notifyPropertyChanged(BR.content);
    }
}
